<?php include load_tpl('header');?>
<p id="breadcrumbs">
    <a href="/">首页</a> <b>»</b> 
    <span>添加产品</span>
</p>

<div class="box">
	<div class="left"></div>
	<div class="right"></div>
    <div class="heading">
      <h1 style="background-image: url('./images/product.png');">添加产品</h1>
    </div>
    <div class="content">
      <form action="" method="post" enctype="multipart/form-data" id="form" name="theForm">
            <table class="productform">
              <tr>
                <td><span class="required">*</span>商品名称:</td>

                <td><input type="text" name="product_name" size="100" value="<?php if(isset($product_info)) echo $product_info['name'];?>" />
                  </td>
              </tr>
			   <tr>
              <td>品牌:</td>
              <td><select name="manufacturer_id">
                  <option value="0" selected="selected"> --- None --- </option>
				  <?php echo $brand_select;?>
				</select>
			  </td>
            </tr>
            <tr>
              <td>分类:</td>
              <td><select name="category_id[]" multiple="multiple" size="8">
			  <?php echo $cat_select;?>
			  </select></td>
			</tr>
			 <tr>
              <td>产品属性:</td>
              <td><select name="attribute_value_id[]" multiple="multiple" size="8">
				  <?php echo $attr_select;?>
				</select>
			  </td>
            </tr>
              <tr>
                <td>Meta标签描述:<br/><span class="help">SEO专用</span></td>
                <td><textarea name="meta_description" cols="80" rows="10"><?php if(isset($product_info)) echo $product_info['meta_keywords'];?></textarea></td>
              </tr>
              <tr>

                <td>Meta标签关键字:<br/><span class="help">SEO专用</span></td>
                <td><textarea name="meta_keyword" cols="80" rows="10"><?php if(isset($product_info)) echo $product_info['meta_description'];?></textarea></td>
              </tr>
              <tr>
                <td>商品描述:</td>
                <td><textarea name="description" id="description" cols="120" rows="30"><?php if(isset($product_info)) echo $product_info['description'];?></textarea></td>
              </tr>

              <tr>
                <td>商品标签:<br /><span class="help">逗号分隔</span></td>
                <td><input type="text" name="product_tag" value="<?php if(isset($tag_str))echo rtrim($tag_str,",");?>" size="80" /></td>
              </tr>
			  <tr>
              <td><span class="required">*</span>型号:</td>
              <td><input type="text" name="model" value="<?php if(isset($product_info)) echo $product_info['model'];?>" />
                </td>
            </tr>
			 <tr>
              <td>面板:</td>
              <td><input type="text" name="panel" value="<?php if(isset($product_info)) echo $product_info['panel'];?>" />
                </td>
            </tr>
			<tr>
              <td>侧/背板:</td>
              <td><input type="text" name="side" value="<?php if(isset($product_info)) echo $product_info['side'];?>" />
                </td>
            </tr>
			<tr>
              <td>琴颈:</td>
              <td><input type="text" name="neck" value="<?php if(isset($product_info)) echo $product_info['neck'];?>" />
                </td>
            </tr>
			<tr>
              <td>指板/琴桥:</td>
              <td><input type="text" name="bridge" value="<?php if(isset($product_info)) echo $product_info['bridge'];?>" />
                </td>
            </tr>
			<tr>
              <td>弦钮:</td>
              <td><input type="text" name="chordbutton" value="<?php if(isset($product_info)) echo $product_info['chordbutton'];?>" />
                </td>
            </tr>
			<tr>
              <td>口轮:</td>
              <td><input type="text" name="srbicularis" value="<?php if(isset($product_info)) echo $product_info['srbicularis'];?>" />
                </td>
            </tr>
			<tr>
              <td>上/下弦枕:</td>
              <td><input type="text" name="saddle" value="<?php if(isset($product_info)) echo $product_info['saddle'];?>" />
                </td>
            </tr>
			<tr>
              <td>琴弦:</td>
              <td><input type="text" name="strings" value="<?php if(isset($product_info)) echo $product_info['strings'];?>" />
                </td>
            </tr>
			<tr>
              <td>弦长:</td>
              <td><input type="text" name="chord" value="<?php if(isset($product_info)) echo $product_info['chord'];?>" />
                </td>
            </tr>
			<tr>
              <td>颜色:</td>
              <td><input type="text" name="color" value="<?php if(isset($product_info)) echo $product_info['color'];?>" />
                </td>
            </tr>
            <tr>
              <td>价格:</td>
              <td><input type="text" name="price" value="<?php if(isset($product_info)) echo $product_info['price'];?>" /></td>
            </tr>
			<tr>
              <td>代理价格:</td>
              <td><input type="text" name="discount_price" value="<?php if(isset($product_info)) echo $product_info['discount_price'];?>" /></td>
            </tr>
            <tr>
              <td>商品库存数量:</td>
              <td><input type="text" name="quantity" value="<?php if(isset($product_info)) echo $product_info['quantity'];else echo 1;?>" size="2" /></td>
            </tr>
            <tr>

              <td>最小数量:<br/><span class="help">强制下单最小数量</span></td>
              <td><input type="text" name="minimum" value="<?php if(isset($product_info)) echo $product_info['minimum'];else echo 1;?>" size="2" /></td>
            </tr>
            <tr>
              <td>库存警告数量:</td>
              <td><input type="text" name="subtract" value="<?php if(isset($product_info)) echo $product_info['subtract'];else echo 1;?>" size="2" /></td>
            </tr>
            <tr>
              <td>库存状态:<br/><span class="help">商品没有库存显示</span></td>
              <td><select name="stock_status_id">
				  <option value="6">2 - 3天</option>
					<option value="7">有库存</option>
					<option value="5" selected="selected">无库存</option>
					<option value="8">预定</option>
				</select></td>
            </tr>
            <tr>
              <td>是否为免运费商品:</td>
              <td><input type="radio" name="shipping" value="1" checked="checked" />是
			  <input type="radio" name="shipping" value="0" />否</td>
            </tr>
            <tr>
              <td>产地:</td>
              <td><input type="text" name="location" value="<?php if(isset($product_info)) echo $product_info['location'];?>" /></td>

            </tr>
            <tr>
            <td class="label">商品重量：</td>
            <td><input type="text" size="20" value="<?php if(isset($product_info)) echo $product_info['weight'];?>" name="product_weight"> 千克</td>
			</tr>
			<tr>
            <td class="label">商品长度：</td>
            <td><input type="text" size="20" value="<?php if(isset($product_info)) echo $product_info['length'];?>" name="product_length"> 厘米</td>
			</tr>
			<tr>
            <td class="label">商品宽度：</td>
            <td><input type="text" size="20" value="<?php if(isset($product_info)) echo $product_info['width'];?>" name="product_width"> 厘米</td>
			</tr>
			<tr>
            <td class="label">商品高度：</td>
            <td><input type="text" size="20" value="<?php if(isset($product_info)) echo $product_info['height'];?>" name="product_height"> 厘米</td>
			</tr>
            <tr>
              <td>上传商品图片:</td>
              <td><input type="file" name="product_image" id="image"/>
			 <?php if(isset($product_info['product_img'])) echo "<img src='product_images/".$product_info['product_img']."'/>";?>
			  </td>
            </tr>
			<tr id="auto_thumb_1">
            <td class="label"> 上传商品缩略图:<br/><span class="help">用于列表显示，大小尺寸最好比较小</span></td>
            <td id="auto_thumb_3">
              <input type="file" size="35" name="product_thumb" disabled="">
             <br/><label for="auto_thumb"><input type="checkbox" onclick="handleAutoThumb(this.checked)" value="1" checked="true" name="auto_thumb" id="auto_thumb">自动生成商品缩略图</label>  
			  <div><?php if(isset($product_info['product_thumb'])) echo "<img src='product_images/".$product_info['product_thumb']."'/>";?>
			  </div></td>
          </tr>
            <tr>
              <td>截止日:</td>
              <td><input type="text" name="date_available" value="<?php if(isset($product_info)) echo $product_info['date_available'];?>" size="12" class="date" /></td>
            </tr>
            <tr>
              <td>上架状态:</td>
              <td><select name="status">
                  <option value="1" <?php if(isset($product_info)&&$product_info['status']==1) echo "selected='selected'";?>>上架</option>
                  <option value="0" <?php if(isset($product_info)&&$product_info['status']==0) echo "selected='selected'";?>>下架</option>
                </select></td>
            </tr>
			<tr>
            <td class="label">加入推荐：</td>
            <td><input type="checkbox" value="1" name="is_best" <?php if(isset($product_info)&&$product_info['is_best']==1) echo "checked"; ?>>精品 
			<input type="checkbox" value="1" name="is_new" <?php if(isset($product_info)&&$product_info['is_new']==1) echo "checked"; ?>>新品 
			<input type="checkbox" value="1" name="is_hot" <?php if(isset($product_info)&&$product_info['is_hot']==1) echo "checked"; ?>>热销
			</td>
          </tr>
            <tr>
              <td>排序权重:</td>
              <td><input type="text" name="sort_order" value="<?php if(isset($product_info)) echo $product_info['sort_order'];else echo 1;?>" size="2" /></td>
            </tr>
			<tr>
			<td colspan="2"><a onclick="$('#form').submit();" class="button"><span>保存</span></a><a onclick="" class="button"><span>取消</span></a></td>
			</tr>
            </table>
			<input type="hidden" name="product_id" value="<?php if(isset($product_info)) echo $product_info['product_id'];?>"/>
        </form>
     </div>
       

<?php include load_tpl('footer');?>
<script type="text/javascript" charset="utf-8" src="./script/kindeditor/kindeditor.js"></script>
<script type="text/javascript"> 
KE.show({
	id : 'description',
	skinType: 'default',
	items : [
    'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
    'removeformat', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
    'insertunorderedlist', 'source']
});
function handleAutoThumb(status){
	document.forms['theForm'].elements['product_thumb'].disabled = status;
}


</script>

